package com.example.demo.service.impl;

import com.example.demo.dto.EmployeeDTO;
import com.example.demo.entity.Employee;
import com.example.demo.mapper.EmployeeRepository;
import com.example.demo.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author honeypeach
 * @date 2023/3/24 14:00
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
 EmployeeRepository employeeRepository;


    @Override
    public Employee findEmployeeById(Long id) {
        return employeeRepository.selectById(id);
    }

    @Override
    public int delete(Long id) {
        return employeeRepository.deleteById(id);
    }

    @Override
    public int insertEmployee(Employee employee) {
        return employeeRepository.insertEmployee(employee);
    }

    @Override
    public Employee getEmployeeWithLeader(EmployeeDTO employeeDTO) {

        return employeeRepository.getEmployeeWithLeader(employeeDTO);
    }

    @Override
    public List<Employee> listEmployees(EmployeeDTO employeeDTO) {
        return employeeRepository.getEmployeeList(employeeDTO);
    }
}
